# -*- coding: utf-8 -*-
# @Time : 2022-06-23 15:15
# @Author : Z
# @Function : 后台管理-菜单管理
from Keywords.inter_keys import Inter

inter = Inter()

# 设置系统地址
inter.set_url('https://pos3-test-gateway.bgyfoodom.com')

# 登陆
inter.post_json('/auth/systemV1/username-login',
                '{"password":"d8GWF69C1A3tOXjb2VP0EaSjgTOD5zF5lRn0Y/yCHJjXdD0XUm+lVmAIO4LMFivLKJkfSm9Rc1cHbWnsNQObRsgY1784HmpIxWCG7Lkf2Aazj8X06u5I5u4/YGRrENS5wgR3VLKGIJLeNcqC1amRqdQXxzsQHuDCcWMKpTPuApc=","name":"15678300490","channelId":"11"}')
# 断言登陆成功
inter.assert_equals('code', '0000')
# 提取token
inter.save_json("$.data.accessToken", "newtoken")
# 添加authorization到请求头
inter.add_header('authorization', '{newtoken}')

# 新增门店菜单
inter.post_json('/manager/product-menu/insert-store-product-menu',
                '{"name": "预约","serialNumber":1550313489139277826,"orderTypeId": 2,"enabled": 1}')
inter.assert_equals('code','0000')


# # 停用菜单
# inter.post_json('/manager/product-menu/update-store-product-menu','{"id":1569496792569823234,"name": "预约","serialNumber": 1550313489139277826,"orderTypeId": 2,"serialNumberProductMenuId":1569496792569823235,"enabled": 0}')
# inter.assert_equals('$.data.enabled','0')

# # 启用菜单
# inter.post_json('/manager/product-menu/update-store-product-menu','{"id":1569496792569823234,"name": "预约","serialNumber": 1550313489139277826,"orderTypeId": 2,"serialNumberProductMenuId":1569496792569823235,"enabled": 1}')
# inter.assert_equals('$.data.enabled','1')

